package com.hdu.redisHashOperator;

import com.hdu.redisHashOperator.entity.School;
import com.hdu.redisHashOperator.entity.User;
import com.hdu.redisHashOperator.service.HashCommandOperator;

public class TestMain {

    public static void main(String[] args) {
        testDelete();
    }

    public static void testSave() {
        User user = new User();
        user.setId(1L);
        user.setName("qiuyuanhai");
        user.setSex("male");
        user.setNickName("qyh");

        School school = new School();
        school.setName("hdu");
        school.setAddress("hdu");
        user.setSchool(school);

        HashCommandOperator.upsert(user);
    }

    public static void testQuery() {
        User user = HashCommandOperator.query(User.class, 1L);
        System.out.println(user);
    }

    public static void testUpdate() {
        User user = new User();
        user.setId(1L);
        user.setName("qiuyuanhaiNew");

        HashCommandOperator.upsert(user);
    }

    public static void testDelete() {
        HashCommandOperator.delete(User.class, 1L);
    }
}
